﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using LYQ.Model;
using LYQ.BLL;
using LYQ.SQLServerDAL;

namespace WebManager
{
    public class Utility
    {
        public static LYQ.Model.S_User CurrentSysUser()
        {
            if (HttpContext.Current.Session["UserInfo"] == null)
            {
                LYQ.BLL.S_User curUserBll = new LYQ.BLL.S_User();
                string UID = HttpContext.Current.User.Identity.Name;
                LYQ.Model.S_User sysUser = curUserBll.GetModel(UID);
                HttpContext.Current.Session["UserInfo"] = sysUser;
                return sysUser;
            }
            else
            {
                return HttpContext.Current.Session["UserInfo"] as LYQ.Model.S_User;
            }
            
        }
    }
}